<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.operations.process.forms.BomPartEntryForm"%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/kitMaking.do?action=BoardMaking" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<html>
    <HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
        <META http-equiv=Content-Type content="text/html; charset=windows-1252">
        <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
    </HEAD>
    <BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
    <script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
    <script src="<%=chipTracContext%>/jsp/includes/scripts/bomPartEntry.js"></script>
    <script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
    <SCRIPT language="JavaScript">

    function submitPage()
    {

        var d       = new Date();
        var day     = d.getDate();
        var month   = d.getMonth()+1;
        var year    = d.getFullYear();
        var hour    = d.getHours();
        var min     = d.getMinutes();
        var sec     = d.getSeconds();
        var defaultPrompt   = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
        var processStepId =    document.bomReportForm.bomPartNumberId.value;
        var processType = document.bomReportForm.processType.value;

        if ( document.bomReportForm.bomPartNumberId.value == '')
            document.bomReportForm.prompt0.value='0';
		else
            document.bomReportForm.prompt0.value = document.bomReportForm.bomPartNumberId.value;

        document.bomReportForm.prompt2.value = defaultPrompt;
        document.bomReportForm.prompt1.value = processType;
        document.bomReportForm.prompt3.value = '';
        document.bomReportForm.prompt4.value = '';
        document.bomReportForm.prompt4.value = '';
        document.bomReportForm.prompt5.value = '';
        document.bomReportForm.prompt6.value = '';
        document.bomReportForm.prompt7.value = '';
        document.bomReportForm.prompt8.value = '';
        document.bomReportForm.prompt9.value = '';
        document.bomReportForm.prompt10.value ='';

        var success;
        success = true;
        var pa	= document.getElementById("errors")
        pa.innerHTML = errMsg;
        if (document.bomReportForm.processType.value == '0' || document.bomReportForm.processType.value == null)
        {
                success = false;
                if(success == false)
                {
                    pa.innerHTML = "<li> Please Select Process Type ";
                }
        }
        if(success == true)
        {
            document.bomReportForm.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/Bom_Inventory_Report.rpt";
            document.bomReportForm.submit();
        }

    }

    /*To reset the Values */
    function reset()
    {
        document.bomReportForm.action = "<%=chipTracContext%>/bomReport.do?action=bomInventoryReport&bomPartNumberId=0&processType=0";
        document.bomReportForm.submit();
    }

    function loadBomParts()
    {
        document.bomReportForm.action = "<%=chipTracContext%>/bomReport.do?action=bomInventoryReport&bomPartNumberId=0";
        document.bomReportForm.submit();
    }

    </script>
    <!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
    <!-- Top Header End-->
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
      <TBODY >
      <TR>
        <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

        <!-- Side Navigation start -->
        <%@ include file="/jsp/operations/reports_side_menu.jsp" %></TD>
        <!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">

        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
        <BR>
        <!-- from here your body starts -->
        <html:form action="/bomReport" name="bomReportForm" type="com.scalar.chiptrack.operations.process.forms.BomReportForm"  scope="request">

        <input type="hidden" name="prompt0">
        <input type="hidden" name="prompt1">
        <input type="hidden" name="prompt2">
        <input type="hidden" name="prompt3">
        <input type="hidden" name="prompt4">
        <input type="hidden" name="prompt5">
        <input type="hidden" name="prompt6">
        <input type="hidden" name="prompt7">
        <input type="hidden" name="prompt8">
        <input type="hidden" name="prompt9">
        <input type="hidden" name="prompt10">

        <TABLE width='95%' align=right cellpadding='3' cellspacing='2' border='0' bordercolor='black'>
                <TR><Td colspan='4' class="NArialW" align=center>BOM Inventory Report</td></tr>
                <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
                <tr><td colspan='4' align="center" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
                <TR><TD colspan='4' id="chiptracErrors"><chiptrack:errors styleClass="NArialL"/></TD></TR>
                <TR><TD colspan='4'><chiptrack:info styleClass="NArialL"/></TD></TR>
                <TR>
                    <TD class='NArialL' width="50%" colspan='2' align="right">BOM Process Type &nbsp;&nbsp;&nbsp; <br>
                    (<bean:message key = "label.mfgPartNumber" />)&nbsp;&nbsp;&nbsp;
                    </TD>
                    <TD class="NArialL" colspan='2'>
                        <html:select property="processType" styleClass="txfield" style="width:150px" onchange="loadBomParts()">
                            <option value="0">Select BOM Process </option>
                            <html:options collection="processTypes" property="value" labelProperty="label"/>
                        </html:select>
                    </TD>
                </TR>
                <TR><TD class='NArialL' width="50%" colspan='2' align="right">BOM Part Number &nbsp;&nbsp;&nbsp;<br>
                <%--(<bean:message key = "label.mfgPartNumber" />)--%>
                </TD>
                    <TD class="NArialL" colspan='2'>
                        <html:select property="bomPartNumberId" styleClass="txfield" style="width:150px" >
                            <html:option value="0">All Products</html:option>
                            <html:optionsCollection name="bomReportForm" property="bomPartNumberList"/>
                        </html:select>
                    </TD>
                </TR>
                <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='20'></TD></TR>
                <TR>
                    <TD colspan = "2" align = "right">
                        <a href="javascript:submitPage()" onmouseover="window.status='Click here to View the BOM Inventory Report';return true" onmouseout="window.status='';return true" title="Click here to View the BOM Inventory Report"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17"></a>
                        &nbsp;&nbsp;&nbsp;
                    </TD>
                    <TD colspan='2'>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:reset()" onmouseover="window.status='Click here to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
                    </TD>
                </TR>

            </table>
        </html:form>
        <!-- till here -->
        <BR><BR>
        </TD><TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD></TR>
        </TABLE>
        <!-- Footer starts here -->
        <%@ include file="/jsp/includes/footer.jsp" %>
        <!-- footer end here -->
    </body>
</html>

<%--
<% }catch(Exception e){ e.printStackTrace(); } %>--%>
